<?

/**
 * Make query to default database
 *
 * @param string $query
 * @return Data
 */
function Q($query)
{
	$db = Sslib::DB();
	return $db->Query($query);
}
function Allow($who, $message = false)
{
	if(!Permission::CheckUser($who))
	{
		if($message === false) $message = __T('access denided');
		print $message;			
		if(Page::ValidateObject())	Page::Draw();
		exit;
	}
}
function __T($message)
{
	return Sslib::LocalizedMessage($message);
}
function RandomKey($len = 16)
{
	$arr = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
	$key='';
	$keylen = strlen($arr)-1;
	for($i = 0; $i != $len; $i++){$key .= $arr[rand(0, $keylen)];}
	return $key;
}
?>